use "$Data_origin/Diocese.dta", clear
gen asin_fun=asinh(civil_funeral_sum)
replace asin_fun=. if year<1928
gen piusXI=1 if evequenomme==4
replace piusXI=0 if evequenomme<4
gen asin_perm=asinh(nb_sectperm)
gen dcivi=civil_funeral_sum-l.civil_funeral_sum
gen asin_dcivi=asinh(dcivi+1)
replace asin_dcivi=. if year<1928

***** Hierarchy variables *****
gen leon=1 if evequenomme==1
replace leon=0 if evequenomme>1
gen eveque_antimo=1 if eveque==1
replace eveque_antimo=1 if evequenomme==4
replace eveque_antimo=0 if evequenomme==3
replace eveque_antimo=0 if evequenomme==2
gen nooppo=1 if evequenomme>1 & evequenomme<4
replace nooppo=0 if evequenomme==1
replace nooppo=0 if evequenomme==4

save "$Data_generated/Diocese.dta", replace
